﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test07
{
    class Program
    {
        //7.对整型数组{20,16,78,61,12,99,57,34,8}进行冒泡排序，要求数据由小到大排列。
        static void Main(string[] args)
        {
            int[] a = new int[]{20,16,78,61,12,99,57,34,8};
            int tmp;
            for (int i=0;i<a.Length;i++)
            {
                for (int j=0;j<a.Length-1-i;j++)
                    if (a[j] > a[j+1])
                    {
                        tmp=a[j];
                        a[j]=a[j+1];
                        a[j+1]=tmp;
                    }
            }
            for (int i=0;i<a.Length;i++)
                Console.Write(a[i].ToString()+" ");
            Console.ReadKey();
        }
    }
}
